//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.tool.utils;

import android.app.Activity;
import android.app.Application;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;

import com.m7788.util.AppUtil;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class LogoutUtil extends Application {
    private List<Activity> activityList;

    private LogoutUtil() {
        this.activityList = new LinkedList();
        DataUtil.dex();
    }

    public static LogoutUtil getInstance() {
        return LogoutUtil.LogoutUtilLoader.instance;
    }

    public void addActivity(Activity activity) {
        this.activityList.add(activity);
    }

    public void exit() {
        Iterator var2 = this.activityList.iterator();

        while(var2.hasNext()) {
            Activity activity = (Activity)var2.next();
            activity.finish();
        }
        AppUtil.destroy();
        System.exit(0);
    }

    public void exit(Context context) {
        (new Builder(context)).setTitle("请确定是否退出应用?").setPositiveButton("确定", new OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                Iterator var4 = LogoutUtil.this.activityList.iterator();

                while(var4.hasNext()) {
                    Activity activity = (Activity)var4.next();
                    activity.finish();
                }

                System.exit(0);
            }
        }).setNegativeButton("取消", new OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
            }
        }).show();
    }

    private static class LogoutUtilLoader {
        private static final LogoutUtil instance = new LogoutUtil();

        private LogoutUtilLoader() {
        }
    }
}
